/**
 * @author ChaP
 * @date 2019/08/16
 * @describe:
 */
package CodingTest.AC20190816;

public class maxProduct {
    public int maxProduct(String[] words){
        if(words == null || words.length == 0){
            return 0;
        }
        int maxValue = 0;
        for(int i = 0;i<words.length;i++){
            String s1 = words[i];
            for(int j = i+1;j<words.length;j++){
                String s2 = words[j];
                if(look(s1,s2)){
                    continue;
                }
                int temp = s1.length()*s2.length();
                if(temp>maxValue){
                    maxValue = temp;
                }
            }
        }
        return maxValue;
    }
    private boolean look(String s1,String s2){
        for(int i = 0;i<s2.length();i++){
            if(s1.contains(s2.substring(i,i+1))){
                return true;
            }
        }
        return false;
    }
}
